package com.bitland.demo.api.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping(value = "/api")
public class ApiController {
    @Value("${server.port}")
    String port;

    @Value("${customize.mysql.server}")
    String mysqlServer;

    @GetMapping({"/hello/{name}"})
    //测试地址 单服务测试地址  http://localhost:7010/provider/api/hello/lisi
    // 网关测试地址  http://localhost:7050/gateway/api-provider/provider/api/hello/lisi
    public String hello(@PathVariable("name") String name) {
        return "hello " + name +",api调用， 我的端口号是: " + port;
    }

    @GetMapping({"/mysqlServer"})
    //测试地址 单服务测试地址  http://localhost:7010/provider/api/mysqlServer
    // 网关测试地址  http://localhost:7050/gateway/api-provider/provider/api/mysqlServer
    public String mysqlServer() {
        return "mysql server: " + mysqlServer;
    }
}
